package com.caineng.zhaobiao.zbapi.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @author liandyao
 * @date 2022/7/18 16:03
 */
@Data
@ApiModel(value = "统一参数", description = "查询分页时的参数")
public class QueryParams implements Serializable {

    @ApiModelProperty(value = "当前第几页", example = "1",required = true)
    private Integer page = 1 ;
    @ApiModelProperty(value = "每页显示条数", example = "10")
    private Integer pageSize =10;

    public Integer getPageSize() {

        if(pageSize>20) pageSize=20 ;

        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    private Integer curPage ;

    /**
     * 因为Pageable page = PageRequest.of()分页是从第0页开始,所以页面上穿过来的 数字 - 1
     * @return
     */
    public Integer getCurPage() {
        return page -1 ;
    }

   /* @ApiModelProperty(value = "查询地区", example = "武汉市")
    private String areaName ;

    @ApiModelProperty(value = "查询省份", example = "湖北省")
    private String provinceName ;

    @ApiModelProperty(value = "查询关键字", example = "老旧小区改造")
    private String keyword ;*/



}
